home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
fastlane.arc
/
TIMER.DOC
< prev
Wrap
Text File
|
1985-10-20
|
3KB
|
56 lines
High Resolution Timer Test Program
---- ---------- ----- ---- -------
The program TIMER.ASM is based on the article in the April 1984 issue
of PC Tech Journal entitled "Life in the Fast Lane" by B. Smith and T.
Puckett. It has been modified slightly to make it easier to use. The
following are the major modifications to the code presented in the
article:
1) The calibration and code to be tested sections have been broken
out into separate subroutines. This means that no modification of
this code is necessary to run timings. Simply set up the two
subroutines as noted below, assemble them separately, and link
in this code. The code to be tested should be placed in two
subroutines: "CALIB", containing any code whose effect is to be
removed from the results (loop control, etc.), and "TEST", which
should contain the actual code to be tested.
2) The number of clock ticks is printed out (albeit crudely), so
one does not have to use debug to run this. The routine prints
out the number of 0.84 microsecond clock ticks (in hex)
Also included are three test routines: TESTIME.ASM, TESTIME2.ASM, and
TESTIME3.ASM. They can be used as examples of how to set up the "TEST"
and "CALIB" routines. TESTIME.ASM and TESTIME2.ASM are simply the test
code published in the article as REGCNV04 and REGCNV05. TESTIME3.ASM
is a third subroutine that performs the same function as the first two,
but is significantly faster (slightly more code, though). This is
the way I normally do the conversion to ascii hex.
To use these routines (using TESTIME as an example), do the following:
A> masm timer; (if timer.obj does not already exist)
A> masm testime;
A> link testime+timer;
A> run testime
The program will print out the number of 0.84 microsecond clock ticks
in hex, so a good hex calculator is useful with this program. With
a little more effort, the output could be scaled to print out directly
in microseconds. As I am usually just interested in determining
relative speeds of two different approaches, I have not done this.
For the examples given, I obtained the following results:
subroutine # ticks
---------- --------
TESTIME 0000007A ( 102 ms )
TESTIME2 00000072 ( 96 ms )
TESTIME3 00000045 ( 58 ms )
For a full description of these routines, I will refer you to the
original article. It explains everything much better than I could.
Enjoy.
Tim Fischer
Lake Elmo, MN